function createRequest() {
  var request;
  try {
    request = new XMLHttpRequest();
  } catch (tryMS) {
    try {
      request = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (otherMS) {
      try {
        request = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (failed) {
        request = null;
      }
    }
  }
   return request;
}
function submitOrder() 
{
    var req = createRequest(); 
    
    var nameUser = document.getElementById("newlogin").value;
    var passUser = document.getElementById("newpassword").value;
    var mail = document.getElementById("e-mail").value;
   if( nameUser.length<4 || passUser.length<7 )
		alert("Пожалуйста, введите Ваше имя и пароль!");
                
	else {
             $('#reg').stop().animate({opacity:'0'},500);
                var url = "/reg";
                req.open("POST", url, true);
                req.onreadystatechange = function() {
                if (req.readyState == 4){
                    if (req.status == 200){
			
			if(req.responseText==0)
			    document.getElementById("registration_review").innerHTML="<b>Спасибо за регистрацию</b>";
			else
			    document.getElementById("registration_review").innerHTML = req.responseText;
			
                    }
                }
            };
                 req.setRequestHeader("Content-Type",
                           "application/x-www-form-urlencoded");
                 req.send("nameUser=" +  encodeURIComponent(nameUser) +
                   "&passUser=" +  encodeURIComponent(passUser) +
                   "&mail=" +  encodeURIComponent(mail));
          }
}
function switc(obj)
{
	var el = document.getElementById(obj);
         
	if(el.style.display != "block")
        {
            el.style.display = "block";
            document.getElementById("nameUser").value = '';
            document.getElementById("phoneUser").value = '';
        }
        else 
        {
		el.style.display = "none";      
        }    
}